<!-- 维修审核页面 -->

<template>
	<view class="dis-review">
		<navBar :title="`${titleObj.navTitle}${titleObj.branchLineName ? '(' + titleObj.branchLineName + ')' : ''}`  || ''"></navBar> 
		<view class="content-colot"></view>
		<view>
			<view class="text-site">
				{{ titleObj.subTitle }}
			</view>
			<view class="box">
				<searchCom class="search-input " v-model="searchText" style="margin-top: 120rpx;" @enter="determine"
					@change="searchChange"></searchCom>
			</view>
			<scroll-view scroll-y="true" style="height:calc(100vh - 500rpx);">
				<view class="all-content" v-show="form && form.length > 0">
					<view class="t-content" v-for="(it, i) in form" :key="i">
						<view class="top-content">
							<view class="top-ring">{{ getContent(it) }}</view>
							<!-- :class="status(it.rankClass)" -->
							<view class="top-lv" :class="{'re':it.rankClass === 'tall','ye':it.rankClass === 'central', 'bl':it.rankClass === 'bottom' || it.rankClass === 'nought'}">
								{{ it.diseaseGradeName || '' }}{{ it.diseaseNo || '' }}
							</view>
						</view>
						<view class="bottem-ev">{{ it.diseaseStatus || '' }}</view>

						<view class="bottem-time">工单号：{{ it.repairOrderNo || '' }}</view>
						<view class="but-t">
							<view class="" style="display: flex;">
								<view class="bottem-ev">
									维修日期：
								</view>
								<view class="bottem-ev-time"
									:class="getDate(it.repairDate) < getDate(new Date()) ? 'red' : ''">
									{{ getDate(it.repairDate) }}</view>
							</view>
							<view class="but-sh" @click="toExamine(i)">
								审核
							</view>
						</view>

					</view>

				</view>
				<u-empty v-if="form.length === 0" mode="list" text="暂无审核数据"
					icon="http://cdn.uviewui.com/uview/empty/data.png">
				</u-empty>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import {
		auditList, // 待维修列表
	} from '@/api/engineeringMaintenance/maintenanceTask.js'
	import navBar from "@/components/navBar/navBar.vue"
	import mixins from "@/utils/mixins.js"
	import searchCom from "@/components/searchCom.vue"
	export default {
		name: 'notRepaired',
		mixins: [mixins],
		components: {
			navBar,
			searchCom

		},
		data() {
			return {
				searchText: undefined,
				form: [],
				common_params: {}, //dispatch组件带过来的入参
				titleObj: {
					navTitle: '',
					siteTitle: '',
					subTitle: '',

				}
			}

		},
		onLoad(params) {
			console.log(params);
			this.common_params = JSON.parse(params.recordParams)
			console.log(this.common_params, '2222')


			this.titleObj = JSON.parse(params.titleParams)
			console.log(this.titleObj);
		},
		onShow() {
			this.reviewed()
		},
		methods: {
			/**
			 * 获取未审核列表
			 * @params // 区间站点id 站点type
			 * 
			 */
			reviewed() {
				let params = {
					// keyword:this.searchText,
					...this.common_params,
					type: 'repair_review',
					keyword: this.searchText,
					projectId:uni.getStorageSync('isOwner')
				}
				auditList({
					params
				}).then(res => {
					if (res.status === 1 && res.success) {
						this.form = res.result.list
					}
				})
			},
			/**
			 * 输入框值变化的时候
			 * @param {String} val
			 */
			searchChange(val) {
				this.searchText = val
				if (this.searchText === '') {
					this.searchText = undefined
				}
				this.reviewed()

			},
			determine(ev) {
				console.log(ev)
			},
			toExamine(e) {
				uni.navigateTo({
					url: "/subpackage-enginner/pages/engineeringMaintenance/repair_check/components/audit",
					success: (res) => {
						console.log(e, '下标');
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('getLists', {
							data: this.form,
							e: e,
							titleObj: this.titleObj
						})
					}
				})
			},
			status(str) {
				if (str === 'tall') {
					return 're'
				} else if (str === 'central') {
					return 'ye'
				} else if (str === 'bottom' || str === 'nought') {
					return 'bl'
				} else {
					return 'bl'
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.dis-review {
		/* #ifdef MP-WEIXIN */
			padding-top: 180rpx;
		/* #endif */
		.box {
			width: 90%;
			margin-left: 30rpx;
		}

		.content-colot {
			height: 40rpx;
			background: #F5F7FA;
		}

		.text-site {
			// height: 100rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #445469;
			line-height: 70rpx;
			margin: 40rpx;
		}

		.search-input {
			margin-top: 20rpx !important;
		}

		.all-content {
			padding-top: 30rpx;

			.t-content {
				// height: 240rpx;
				border-bottom: 2rpx dashed #f4f4f5;
				padding: 30rpx;
			}

			.top-content {
				display: flex;
				justify-content: flex-start;
				align-items: center;

				.top-ring {
					// height: 44rpx;
					max-width: 400rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #445469;
					line-height: 38rpx;
					margin-right: 20rpx;
				}

				.top-lv {
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					padding: 0 20rpx;
					// height: 40rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 38rpx;
					background: linear-gradient(90deg, #5295FE 0%, #3FB8FF 100%);
					text-align: center;
				}

				.top-con {
					clip-path: polygon(15rpx 0, 100% 0, calc(100% - 15rpx) 52rpx, 0% 52rpx);
					height: 40rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 38rpx;
					background: #C6CDD8;
					text-align: center;
					padding: 0 14rpx;
				}
			}

			.bottem-ev {
				margin-top: 10rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #6A819E;
				line-height: 32rpx;
				max-width: 500rpx;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}

			.bottem-ev-time {
				max-width: 420rpx;
				margin-top: 10rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #6A819E;
				line-height: 32rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
			}

			.red {
				color: #FF6A6A;
			}

			.bottem-time {
				margin-top: 10rpx;
				height: 40rpx;
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #6A819E;
				line-height: 32rpx;
			}

			.but-t {
				display: flex;
				justify-content: space-between;

				.but-sh {
					// width: 130rpx;
					padding: 0 20rpx;
					height: 52rpx;
					background: #2F80ED;
					font-size: 28rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 52rpx;
					text-align: center;
				}
			}

			.ye {
				background: linear-gradient(90deg, #FF882B 0%, #FF9F3D 100%) !important;
			}

			.re {
				background: linear-gradient(90deg, #FF2B2B 0%, #FF603D 100%) !important;
			}

			.bl {
				background: linear-gradient(90deg, #5295FE 0%, #3FB8FF 100%) !important;
			}
		}
	}
</style>
